package com.lzhsite.technology.designPattern.command.RestaurantDemo;

import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * 订单列表
 * 
 * @author lzhcode
 *
 */
public class CommandQueue {
	
	private static Queue<ICommand> commands = new ArrayBlockingQueue<ICommand>(200);

	public  static void addMenu(MenuCommand menuCommand) {
		for (ICommand command : menuCommand.getCommands()) {
			commands.add(command);
		}
	}

	public static void removeOneCommand() {

		if (commands.size() > 0) {
			commands.poll();
		}
	}

	public static ICommand getOneCommand() {
		ICommand command = null;

		if (commands.size() > 0) {
			command = commands.peek();
		}
		return command;
	}
}
